/*
 * @(#)XfsimPlot.java        2003/01/01
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */


package xfuzzy.xfsim.model;


/**
 * Clase que configura un panel de representaci�n gr�fica de dos
 * variables de la simulaci�n
 * 
 * @author Francisco Jos� Moreno Velo
 *
 */
public class XfsimPlot extends XfsimOutput {
	
	//----------------------------------------------------------------------------//
	//                            MIEMBROS PRIVADOS                               //
	//----------------------------------------------------------------------------//
		
	/**
	 * Variable a representar en el eje X
	 */
	private String xvar;
	
	/**
	 * Variable a representar en el eje Y
	 */
	private String yvar;
	
	/**
	 * Tipo de representaci�n (con puntos, c�rculos, l�neas, etc.)
	 */
	private int kind;
			
	//----------------------------------------------------------------------------//
	//                                CONSTRUCTOR                                 //
	//----------------------------------------------------------------------------//
	
	/**
	 * Constructor
	 * @param xst
	 * @param yst
	 * @param kind
	 */
	public XfsimPlot(String xvar, String yvar, int kind) {
		this.kind = kind;
		this.xvar = xvar;
		this.yvar = yvar;
	}
	
	//----------------------------------------------------------------------------//
	//                             M�TODOS P�BLICOS                               //
	//----------------------------------------------------------------------------//
	
	/**
	 * Obtiene un duplicado del objeto
	 */
	public XfsimPlot duplicate() {
		return new XfsimPlot(new String(xvar), new String(yvar), kind);
	}
	
	/**
	 * Copia los valores de otro objeto
	 */
	public void copyFrom(XfsimPlot plot) {
		this.xvar = plot.getXvar();
		this.yvar = plot.getYvar();
		this.kind = plot.getKind();
	}
	
	/**
	 *  Devuelve el nombre de la variable X
	 */
	public String getXvar() {
		return this.xvar;
	}
	
	/**
	 * Devuelve el nombre de la variable Y
	 */
	public String getYvar() {
		return this.yvar;
	}
	
	/**
	 * Devuelve el tipo de representaci�n
	 */
	public int getKind() {
		return this.kind;
	}
			
	/**
	 *  Asigna el nombre de la variable X
	 */
	public void setXvar(String var) {
		this.xvar = var;
	}
	
	/**
	 * Asigna el nombre de la variable Y
	 */
	public void setYvar(String var) {
		this.yvar = var;
	}
	
	/**
	 * Asigna el tipo de representaci�n
	 */
	public void setKind(int k) {
		this.kind = k;
	}
			
	/**
	 * Descripci�n que aparece en la lista de Xfsim
	 */
	public String toString() {
		return "plot("+xvar+","+yvar+","+kind+")";
	}
	
	/**
	 * Descripci�n que aparece en los ficheros de configuracion
	 */
	public String toXML() {
		String eol = System.getProperty("line.separator", "\n");
		return "\t\t<plot xvar=\""+xvar+"\" yvar=\""+yvar+"\" kind=\""+kind+"\" ></plot>"+eol;

	}	

}
